abstract class HasName implements Comparable {
  
  private final String name;

  HasName(String name) {
    this.name = name;
  }

  public final String getName() {
    return name;
  }

  public final int compareTo(Object o) {
    if (!(o instanceof HasName)) return -1;
    HasName that = (HasName)o;
    return this.getName().compareTo(that.getName());
  }

  public String toString() {
    return name;
  }

  public void toString(int tabs, StringBuffer s) {
    for (int i=0; i<tabs; i++) s.append(' ');
    s.append(getName());
    s.append("\n");
  }
}